import json
import requests
import baozou_insert_sql
Platform = "西瓜阅读_轻吧小说"
def xigua1():
        r = requests.session()
        url = "https://www.koread.cn/admin/index/login?url=%2Fadmin%2Findex%2Flogout"
        date ={
                "username" : "",
                "password" : ""
        }
        rr = r.post(url = url,data = date)
        header ={

                "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36",
                "X-Requested-With": "XMLHttpRequest"
        }
        aa = r.get(url="https://www.koread.cn/admin/collect/index?limit=10",headers = header)
        html = json.loads(aa.text)
        date_time = html["rows"][0]["createdate"]
        Amount_share = html["rows"][0]["recharge_money_benefit"]

        # print(date_time,Amount_share,Platform)

        # 数据入库
        try:
                baozou_insert_sql.baozou_spider_everyday_sum(date_time,Amount_share,Platform)
        except  Exception:
                print("数据入库失败")